package cn.chengpengper.im.platform.common.filter;

import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/*@formatter:off*/

/**
 * ____________________
 * < 神兽护体，永无bug! >
 * --------------------
 *
 * @author huchengpeng
 * @version v1.0.0
 * @date 2024/11/23 18:29
 * @description 缓存过滤器
 */

/*@formatter:on*/

@Component
@ServletComponentScan
@WebFilter(urlPatterns = "/*", filterName = "cacheFilter")
public class CacheFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        filterChain.doFilter(new CacheHttpServletRequestWrapper(((HttpServletRequest) servletRequest)), servletResponse);
    }
}
